<template>
  <div class="detailContainer slide-enter-active">
    <lay-header title="影片详情">
      <i class="iconfont icon-right" @touchstart="goback"></i>
    </lay-header>
    <Loading v-if="isLoading" />
		<div v-else id="content" class="contentDetail">
			<!-- <div class="detail_list">
				<div class="detail_list_bg"></div>
				<div class="detail_list_filter"></div>
				<div class="detail_list_content">
					<div class="detail_list_img">
						<img src="/images/movie_1.jpg" alt="">
					</div>
					<div class="detail_list_info">
						<h2>无名之辈</h2>
						<p>A Cool Fish</p>
						<p>9.2</p>
						<p>剧情,喜剧,犯罪</p>
						<p>中国大陆 / 108分钟</p>
						<p>2018-11-16大陆上映</p>
					</div>
				</div>
			</div>
			<div class="detail_intro">
				<p>在一座山间小城中，一对低配劫匪、一个落魄的泼皮保安、一个身体残疾却性格彪悍的残毒舌女以及一系列生活在社会不同轨迹上的小人物，在一个貌似平常的日子里，因为一把丢失的老枪和一桩当天发生在城中的乌龙劫案，从而被阴差阳错地拧到一起，发生的一幕幕令人啼笑皆非的荒诞喜剧。</p>
			</div>
			<div class="detail_player swiper-container">
				<ul class="swiper-wrapper">
					<li class="swiper-slide">
						<div>
							<img src="/images/person_1.webp" alt="">
						</div>
						<p>陈建斌</p>
						<p>马先勇</p>
					</li>
				</ul>
			</div> -->
			<div class="detail_list" :style="{'background-image': 'url('+ detailMovie.img.replace('w\.h','148.208') +')'}">
				<div class="detail_list_bg"></div>
				<div class="detail_list_filter"></div>
				<div class="detail_list_content">
					<div class="detail_list_img">
						<img :src="detailMovie.img | setWH('148.208')" alt="">
					</div>
					<div class="detail_list_info">
						<h2>{{ detailMovie.nm }}</h2>
						<p>{{ detailMovie.enm }}</p>
						<p>{{ detailMovie.sc }}</p>
						<p>{{ detailMovie.cat }}</p>
						<p>{{ detailMovie.src }} / {{ detailMovie.dur }}分钟</p>
						<p>{{ detailMovie.pubDesc }}</p>
					</div>
				</div>
			</div>
			<div class="detail_intro">
				<p>{{ detailMovie.dra }}</p>
			</div>
			<div class="detail_player swiper-container">
        <swiper :options="swiperOption" ref="mySwiper">
          <swiper-slide v-for="(item,index) in detailMovie.photos" :key="index">
            <div>
							<img :src="item | setWH('140.127')" alt="">
						</div>
          </swiper-slide>
        </swiper>
			</div>
		</div>
	</div>
</template>

<script>
  import { getMovieDetail } from '@/api/api'
  import layHeader from '@/components/header'
  import 'swiper/dist/css/swiper.css'
  import { swiper, swiperSlide } from 'vue-awesome-swiper'

  export default {
    name: 'moviedetail',
    data() {
      return {
        detailMovie: {},
        isLoading: true,
        swiperOption: {
          slidesPerView : 'auto',
          freeMode : true,
          freeModeSticky: true
        }
      }
    },
    props: ['movieId'],
    mounted() {
      console.log(this.movieId)
      this.loadDetail()
    },
    methods: {
      loadDetail() {
        this.isLoading = true
        getMovieDetail(null, { movieId: this.movieId}).then(res => {
          let resData = res.data
          this.isLoading = false
          if (resData.msg === 'ok') {
            this.detailMovie = resData.data.detailMovie
          }
        })
      },
      goback() {
        this.$router.back()
      }
    },
    components: {
      layHeader,
      swiper,
      swiperSlide
    }
  }
</script>
<style scoped>
.detailContainer.slide-enter-active {
  animation: slideAnimate .3s ease-in;
}
@keyframes slideAnimate {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}
</style>
